#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h> 
int main(int argc, char *argv[]) {
  struct hostent *he;
  char **addrlist;
  int i;

  if (argc != 2) {
    printf("Usage: %s <domain>\n", argv[0]);
    return 1;
  }

  he = gethostbyname(argv[1]);
  if (he == NULL) {
    herror("gethostbyname");
    return 1;
  }

  addrlist = he->h_addr_list;
  for (i = 0; addrlist[i] != NULL; i++) {
    printf("%s\n", inet_ntoa(*(struct in_addr *)addrlist[i]));
  }

  return 0;
}